<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload=function(){
          var oTxt=document.getElementById('txt1');
          var oBtn=document.getElementById('btn1');
          oBtn.onclick=function(){
            //oTxt.value='aadga';
            //oTxt['value']='adgdg';
              //第三种方法
              oTxt.setAttribute('value','dgdgsdgh');

          };
        };
    </script>
</head>
<body>
<input type="text" id="txt1">
<input type="button" id="btn1" value="按钮">
</body>
</html>